<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Arduino LibHelix: src/AACDecoderHelix.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Arduino LibHelix
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">AACDecoderHelix.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#pragma once</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;CommonHelix.h&quot;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;libhelix-aac/aacdec.h&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="keyword">namespace </span>libhelix {</div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160; </div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="keyword">typedef</span> void (*AACInfoCallback)(_AACFrameInfo &amp;info, <span class="keywordtype">void</span> *ref);</div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="keyword">typedef</span> void (*AACDataCallback)(_AACFrameInfo &amp;info, <span class="keywordtype">short</span> *pcm_buffer,</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;                                <span class="keywordtype">size_t</span> len, <span class="keywordtype">void</span> *ref);</div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html">   19</a></span>&#160;<span class="keyword">class </span><a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html">AACDecoderHelix</a> : <span class="keyword">public</span> <a class="code" href="classlibhelix_1_1_common_helix.html">CommonHelix</a> {</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;  <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html">AACDecoderHelix</a>() {</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;    <a class="code" href="classlibhelix_1_1_common_helix.html#a843186aabc424e76ca263145917640d5">setMinFrameBufferSize</a>(AAC_MIN_FRAME_SIZE);</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;  }</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#if defined(ARDUINO) || defined(HELIX_PRINT)</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;  <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html">AACDecoderHelix</a>(Print &amp;output) { </div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;    <a class="code" href="classlibhelix_1_1_common_helix.html#a843186aabc424e76ca263145917640d5">setMinFrameBufferSize</a>(AAC_MIN_FRAME_SIZE);</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;    this-&gt;out = &amp;output; </div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;  }</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160; </div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;  <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html">AACDecoderHelix</a>(AACDataCallback dataCallback) {</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <a class="code" href="classlibhelix_1_1_common_helix.html#a843186aabc424e76ca263145917640d5">setMinFrameBufferSize</a>(AAC_MIN_FRAME_SIZE);</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    this-&gt;pcmCallback = dataCallback;</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;  }</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;  <span class="keyword">virtual</span> ~<a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html">AACDecoderHelix</a>() { <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a785e35c734f7351daaca0b915cf4fb68">end</a>(); }</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160; </div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;  <span class="keywordtype">void</span> setInfoCallback(AACInfoCallback cb, <span class="keywordtype">void</span> *caller = <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    this-&gt;infoCallback = cb;</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <span class="keywordflow">if</span> (caller!=<span class="keyword">nullptr</span>)</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;      p_caller_ref = caller;</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;  }</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160; </div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;  <span class="keywordtype">void</span> setDataCallback(AACDataCallback cb) { this-&gt;pcmCallback = cb; }</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160; </div>
<div class="line"><a name="l00048"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a25c720a79d70bf35da7405442686512d">   48</a></span>&#160;  _AACFrameInfo <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a25c720a79d70bf35da7405442686512d">audioInfo</a>() { <span class="keywordflow">return</span> aacFrameInfo; }</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a785e35c734f7351daaca0b915cf4fb68">   51</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a785e35c734f7351daaca0b915cf4fb68">end</a>()<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    LOG_HELIX(LogLevelHelix::Debug, <span class="stringliteral">&quot;end&quot;</span>);</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="keywordflow">if</span> (decoder != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;      <a class="code" href="classlibhelix_1_1_common_helix.html#a31a21e065ebe6924103d2bfe1e70509a">flush</a>();</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;      AACFreeDecoder(decoder);</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;      decoder = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    }</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <a class="code" href="classlibhelix_1_1_common_helix.html#a60813d990b6b255e4e95fe797a36540a">CommonHelix::end</a>();</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    memset(&amp;aacFrameInfo, 0, <span class="keyword">sizeof</span>(_AACFrameInfo));</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;  }</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#acffadea654dec9e804581b0cb5f42cd3">   62</a></span>&#160;  <span class="keywordtype">size_t</span> <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#acffadea654dec9e804581b0cb5f42cd3">maxFrameSize</a>()<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keywordflow">return</span> max_frame_size == 0 ? AAC_MAX_FRAME_SIZE : max_frame_size;</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;  }</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a273fb7ceca9e4e213c5e7722c77cc461">   66</a></span>&#160;  <span class="keywordtype">size_t</span> <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a273fb7ceca9e4e213c5e7722c77cc461">maxPCMSize</a>()<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <span class="keywordflow">return</span> max_pcm_size == 0 ? AAC_MAX_OUTPUT_SIZE : max_pcm_size;</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;  }</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#abdfad65dca1bff4b7d7d82566540d0fd">   71</a></span>&#160;  <span class="keywordtype">void</span> <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#abdfad65dca1bff4b7d7d82566540d0fd">setAudioInfo</a>(<span class="keywordtype">int</span> channels, <span class="keywordtype">int</span> samplerate) {</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    memset(&amp;aacFrameInfo, 0, <span class="keyword">sizeof</span>(AACFrameInfo));</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    aacFrameInfo.nChans = channels;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="comment">// aacFrameInfo.bitsPerSample = bits; not used</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    aacFrameInfo.sampRateCore = samplerate;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    aacFrameInfo.profile = AAC_PROFILE_LC;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    AACSetRawBlockParams(decoder, 0, &amp;aacFrameInfo);</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  }</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160; </div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160; <span class="keyword">protected</span>:</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;  HAACDecoder decoder = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;  AACDataCallback pcmCallback = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;  AACInfoCallback infoCallback = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;  _AACFrameInfo aacFrameInfo;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  <span class="keywordtype">void</span> *p_caller_data = <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160; </div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#ac64dd8567d6e2340588f8dfdfc3919e3">   88</a></span>&#160;  <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#ac64dd8567d6e2340588f8dfdfc3919e3">allocateDecoder</a>()<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    <span class="keywordflow">if</span> (decoder == <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;      decoder = AACInitDecoder();</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    }</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    memset(&amp;aacFrameInfo, 0, <span class="keyword">sizeof</span>(_AACFrameInfo));</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="keywordflow">return</span> decoder != <span class="keyword">nullptr</span>;</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;  }</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160; </div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#ad203976ab151275415f218edad60f4e0">   97</a></span>&#160;  <span class="keywordtype">int</span> <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#ad203976ab151275415f218edad60f4e0">findSynchWord</a>(<span class="keywordtype">int</span> offset = 0)<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <span class="keywordflow">if</span> (offset &gt; frame_buffer.available()) <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <span class="keywordtype">int</span> result = AACFindSyncWord(frame_buffer.data() + offset,</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;                                 frame_buffer.available() - offset);</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="keywordflow">if</span> (result &lt; 0) <span class="keywordflow">return</span> result;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="keywordflow">return</span> offset == 0 ? result : result - offset;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  }</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="classlibhelix_1_1_a_a_c_decoder_helix.html#aa7ad561194233d8944536413cfa160dc">  106</a></span>&#160;  <span class="keywordtype">int</span> <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#aa7ad561194233d8944536413cfa160dc">decode</a>()<span class="keyword"> override </span>{</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="keywordtype">int</span> processed = 0;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="keywordtype">int</span> available = frame_buffer.available();</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    <span class="keywordtype">int</span> bytes_left = frame_buffer.available();</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    uint8_t *data = frame_buffer.data();</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;    <span class="keywordtype">int</span> rc = AACDecode(decoder, &amp;data, &amp;bytes_left, (<span class="keywordtype">short</span> *)pcm_buffer.data());</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <span class="keywordflow">if</span> (rc == 0) {    </div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;      processed = data - frame_buffer.data();</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;      <span class="comment">// return the decoded result</span></div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;      _AACFrameInfo info;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;      AACGetLastFrameInfo(decoder, &amp;info);</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;      provideResult(info);</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;    }</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    <span class="keywordflow">return</span> processed;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;  }</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;  <span class="comment">// return the result PCM data</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;  <span class="keywordtype">void</span> provideResult(_AACFrameInfo &amp;info) {</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    <span class="comment">// increase PCM size if this fails</span></div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordtype">int</span> sampleSize = info.bitsPerSample / 8;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    assert(info.outputSamps * sampleSize &lt;= <a class="code" href="classlibhelix_1_1_a_a_c_decoder_helix.html#a273fb7ceca9e4e213c5e7722c77cc461">maxPCMSize</a>());</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;    </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    LOG_HELIX(LogLevelHelix::Debug, <span class="stringliteral">&quot;==&gt; provideResult: %d samples&quot;</span>, info.outputSamps);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;    <span class="keywordflow">if</span> (info.outputSamps &gt; 0) {</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;      <span class="comment">// provide result</span></div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;      <span class="keywordflow">if</span> (pcmCallback != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        <span class="comment">// output via callback</span></div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        pcmCallback(info, (<span class="keywordtype">short</span> *)pcm_buffer.data(), info.outputSamps,</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;                    p_caller_data);</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;      } <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;        <span class="comment">// output to stream</span></div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        <span class="keywordflow">if</span> (info.sampRateOut != aacFrameInfo.sampRateOut &amp;&amp;</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;            infoCallback != <span class="keyword">nullptr</span>) {</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;          infoCallback(info, p_caller_ref);</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;        }</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;<span class="preprocessor">#if defined(ARDUINO) || defined(HELIX_PRINT)</span></div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;        out-&gt;write((uint8_t *)pcm_buffer.data(), info.outputSamps * sampleSize);</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;      }</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;      aacFrameInfo = info;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    }</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;  }</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;};</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;}  <span class="comment">// namespace libhelix</span></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html">libhelix::AACDecoderHelix</a></div><div class="ttdoc">A simple Arduino API for the libhelix AAC decoder. The data us provided with the help of write() call...</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:19</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_a25c720a79d70bf35da7405442686512d"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#a25c720a79d70bf35da7405442686512d">libhelix::AACDecoderHelix::audioInfo</a></div><div class="ttdeci">_AACFrameInfo audioInfo()</div><div class="ttdoc">Provides the last available _AACFrameInfo_t.</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:48</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_a273fb7ceca9e4e213c5e7722c77cc461"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#a273fb7ceca9e4e213c5e7722c77cc461">libhelix::AACDecoderHelix::maxPCMSize</a></div><div class="ttdeci">size_t maxPCMSize() override</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:66</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_a785e35c734f7351daaca0b915cf4fb68"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#a785e35c734f7351daaca0b915cf4fb68">libhelix::AACDecoderHelix::end</a></div><div class="ttdeci">virtual void end() override</div><div class="ttdoc">Releases the reserved memory.</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:51</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_aa7ad561194233d8944536413cfa160dc"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#aa7ad561194233d8944536413cfa160dc">libhelix::AACDecoderHelix::decode</a></div><div class="ttdeci">int decode() override</div><div class="ttdoc">decods the data and removes the decoded frame from the buffer</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:106</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_abdfad65dca1bff4b7d7d82566540d0fd"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#abdfad65dca1bff4b7d7d82566540d0fd">libhelix::AACDecoderHelix::setAudioInfo</a></div><div class="ttdeci">void setAudioInfo(int channels, int samplerate)</div><div class="ttdoc">Used by M3A format.</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:71</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_ac64dd8567d6e2340588f8dfdfc3919e3"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#ac64dd8567d6e2340588f8dfdfc3919e3">libhelix::AACDecoderHelix::allocateDecoder</a></div><div class="ttdeci">virtual bool allocateDecoder() override</div><div class="ttdoc">Allocate the decoder.</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:88</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_acffadea654dec9e804581b0cb5f42cd3"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#acffadea654dec9e804581b0cb5f42cd3">libhelix::AACDecoderHelix::maxFrameSize</a></div><div class="ttdeci">size_t maxFrameSize() override</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:62</div></div>
<div class="ttc" id="aclasslibhelix_1_1_a_a_c_decoder_helix_html_ad203976ab151275415f218edad60f4e0"><div class="ttname"><a href="classlibhelix_1_1_a_a_c_decoder_helix.html#ad203976ab151275415f218edad60f4e0">libhelix::AACDecoderHelix::findSynchWord</a></div><div class="ttdeci">int findSynchWord(int offset=0) override</div><div class="ttdoc">finds the sync word in the buffer</div><div class="ttdef"><b>Definition:</b> AACDecoderHelix.h:97</div></div>
<div class="ttc" id="aclasslibhelix_1_1_common_helix_html"><div class="ttname"><a href="classlibhelix_1_1_common_helix.html">libhelix::CommonHelix</a></div><div class="ttdoc">Common Simple Arduino API.</div><div class="ttdef"><b>Definition:</b> CommonHelix.h:33</div></div>
<div class="ttc" id="aclasslibhelix_1_1_common_helix_html_a31a21e065ebe6924103d2bfe1e70509a"><div class="ttname"><a href="classlibhelix_1_1_common_helix.html#a31a21e065ebe6924103d2bfe1e70509a">libhelix::CommonHelix::flush</a></div><div class="ttdeci">void flush()</div><div class="ttdoc">Decode all open packets.</div><div class="ttdef"><b>Definition:</b> CommonHelix.h:102</div></div>
<div class="ttc" id="aclasslibhelix_1_1_common_helix_html_a60813d990b6b255e4e95fe797a36540a"><div class="ttname"><a href="classlibhelix_1_1_common_helix.html#a60813d990b6b255e4e95fe797a36540a">libhelix::CommonHelix::end</a></div><div class="ttdeci">virtual void end()</div><div class="ttdoc">Releases the reserved memory.</div><div class="ttdef"><b>Definition:</b> CommonHelix.h:63</div></div>
<div class="ttc" id="aclasslibhelix_1_1_common_helix_html_a843186aabc424e76ca263145917640d5"><div class="ttname"><a href="classlibhelix_1_1_common_helix.html#a843186aabc424e76ca263145917640d5">libhelix::CommonHelix::setMinFrameBufferSize</a></div><div class="ttdeci">virtual void setMinFrameBufferSize(int size)</div><div class="ttdoc">Defines the minimum frame buffer size which is required before starting the decoding.</div><div class="ttdef"><b>Definition:</b> CommonHelix.h:243</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
